<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  
</head>
<body>
  <div id="app">
    <ul>
      <li v-for="el in arr">
        <!-- el作用域是li的内部 -->
        {{ el }}
        
      </li>
    </ul>
    <hr>
    <ul>
      <li v-for="(el,index) in arr">
        <!-- el作用域是li的内部 -->
        {{ el }} ==> {{index}}
      </li>
    </ul>
    <hr>
    <ul>
      <li v-for="(v,key,index) in json">
        {{ v }}  => {{ key }} => {{index}}
      </li>
    </ul>
    <hr>
    <ul>
      <li v-for="(item,index) in items">
        <h5>商品名称：{{item.itemName}}</h5>
        <p>商品价格：{{item.itemPrice}}</p>
         <p>购买数量: {{ item.itemNum }} </p>
      </li>
    </ul>
  </div>
  <script src="./vue.js"></script>
  <script>
    const vm = new Vue({
      el:'#app',
      data:{
        arr: ['秃驴','猴子','好色猪','河妖'],
        json:{
          name:"小二狗",
          age:10,
          gender:'男' // 1男 0 女
        },
        items:[
          {
            itemName:"商品1",
            itemPrice: 20,
            itemNum: 2
          },
          {
            itemName:"商品2",
            itemPrice: 30,
            itemNum: 5
          },
          {
            itemName:"商品3",
            itemPrice: 450,
            itemNum: 6
          }
        ]
      }
    })
  </script>
</body>
</html>
